package screens 
{
	import com.greensock.easing.Back;
	import com.greensock.plugins.TintPlugin;
	import feathers.controls.ScrollContainer;
	import feathers.layout.HorizontalLayout;
	import feathers.layout.VerticalLayout;
	import flash.external.ExternalInterface;
	import flash.media.Sound;
	import Loadtext.LoadText;
	import flash.display.Bitmap;
	import flash.display.Graphics;
	import flash.display.Loader;
	import flash.display.Shape;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import objects.Bartrack;
	import objects.BaseBuild;
	import objects.BaseBuild;
	import objects.Canon;
	import objects.Enemy;
	import objects.LoadEnemy;
	import objects.MyObject;
	import objects.Path;
	import objects.Solider;
	import objects.SoliderChinese;
	import objects.Star_Effect;
	import objects.TestAnimation;
	import objects.Tower;
	import objects.updateStarListItem;
	import starling.animation.DelayedCall;
	import starling.core.Starling;
	import starling.display.BlendMode;
	import starling.display.Image;
	import starling.display.MovieClip;
	import starling.display.Quad;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.events.Touch;
	import starling.events.TouchEvent;
	import starling.events.TouchPhase;
	import starling.extensions.PDParticleSystem;
	import starling.filters.BlurFilter;
	import starling.filters.ColorMatrixFilter;
	import starling.text.TextField;
	import starling.textures.Texture;
	import starling.utils.VAlign;
	import starling.utils.HAlign;
	import Assets;
	import objects.ManagerObject;
	import objects.ManagerEffect;
	import objects.Road;
	import events.NavigationEvent;
	import starling.events.EnterFrameEvent;
	import Audio.SoundManager;

	/**
	 * ...
	 * @author Tuan
	 */
	public class Menu extends Sprite
	{
		//Embed music
		[Embed(source = "../../media/sounds/Menu_Music.mp3")]
		private static const Menu_Music:Class;
		[Embed(source = "../../media/sounds/ChooseStage_Music.mp3")]
		private static const ChooseStage_Music:Class;
		[Embed(source = "../../media/sounds/ChooseLevel_Music.mp3")]
		private static const ChooseLevel_Music:Class;
		[Embed(source = "../../media/sounds/GamePlay_Music.mp3")]
		private static const GamePlay_Music:Class;
		[Embed(source = "../../media/sounds/Win_Music.mp3")]
		private static const Win_Music:Class;
		[Embed(source = "../../media/sounds/Lose_Music.mp3")]
		private static const Lose_Music:Class;
		[Embed(source = "../../media/sounds/ChooseQuestion_Music.mp3")]
		private static const ChooseQuestion_Music:Class;
		[Embed(source = "../../media/sounds/Question_Music.mp3")]
		private static const Question_Music:Class;
		[Embed(source = "../../media/sounds/Update_Music.mp3")]
		private static const Update_Music:Class;
		//Embed sound
		[Embed(source = "../../media/sounds/Sound_Click.mp3")]
		private static const Sound_Click:Class;
		[Embed(source = "../../media/sounds/Sound_Sword.mp3")]
		private static const Sound_Sword:Class;
		[Embed(source = "../../media/sounds/Sound_Canon.mp3")]
		private static const Sound_Canon:Class; 
		//effect arrow
		[Embed(source = "../../media/sounds/effectarrow.mp3")]
		private static const Sound_arrow:Class; 
		//effect sword
		[Embed(source = "../../media/sounds/effectsword.mp3")]
		private static const Sound_Blade :Class
		
		public var m_background:Image;
		public var m_button_Start:Image;
		public var m_button_MusicOn:Image;
		public var m_button_MusicOff:Image;
		public var m_button_SoundOn:Image;
		public var m_button_SoundOff:Image;
		public var m_button_Question:Image;
		public var m_Khung_Ten:Image;
		public var m_button_Update:Image;
		public var m_text_Start:TextField;
		public var m_text_Question:TextField;
		public var m_textUrl:TextField;
		public var m_testStart:Boolean;
		public var m_testInit:Boolean;
		public var m_rung:int;
		public var m_rung1:int;
		public var m_rung2:int;
		public var m_rung3:int;
		public var m_rung4:int;
		public var m_rung5:int;
		public var m_rung6:int;
		public var m_rung8:int;
		public var m_test_guide:Boolean;
		public var m_guide_image_1:Image;
		public var m_guide_image_2:Image;
		public var m_guide_image_3:Image;
		public var m_guide_image_4:Image;
		public var m_guide_image_5:Image;
		public var m_guide_next:Image;
		public var m_test_move_guide:Boolean;
		private var m_rung7:Number;
		public function Menu() 
		{
			m_textUrl=new TextField(500, 50, "", "MyFontName", 30, 0x332616);
			m_text_Start=new TextField(500, 50, "Vào trò chơi", "MyFontName", 30, 0x332616);
			m_text_Question = new TextField(500, 50, "Thi Trạng nguyên", "MyFontName", 30, 0x332616);
			this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
			this.addEventListener(starling.events.Event.ENTER_FRAME, update);
			this.addEventListener(TouchEvent.TOUCH, onTouch);
			super();	
		}
		public function moveleft(obj:Object, pos:int):void
		{
			if (obj.x >= pos)
			{
				obj.x -= 20;
			}
			else
			{
				m_test_move_guide = false;
				obj.x = pos;
			}
		}
		private function onTouch(e:TouchEvent):void
		{
			var touch:Touch = e.getTouch(stage);
			if (touch)
			{
				if (touch.phase == TouchPhase.BEGAN)
				{
					if (m_guide_next.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true)
					{
						if (m_test_move_guide == false)
						{
							database.instance.m_Sound.playSound("Sound_Click");
							m_test_move_guide = true;
						}
					}
					
					if (m_button_Start.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true)
					{
						this.dispatchEvent(new NavigationEvent(NavigationEvent.CHANGE_SCREEN, { id:"Menu-ChooseStage" }, true));
						if (database.instance.m_testPlaySound == true)
							database.instance.m_Sound.playSound("Sound_Click");
					}
					if (m_button_Question.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true)
					{
						this.dispatchEvent(new NavigationEvent(NavigationEvent.CHANGE_SCREEN, { id:"Menu-ChooseQuestion" }, true));
						if (database.instance.m_testPlaySound == true)
							database.instance.m_Sound.playSound("Sound_Click");
					}
					if (m_button_Update.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true)
					{
						//ExternalInterface.call("openFeedDialog");
						if (database.instance.m_testPlaySound == true)
							database.instance.m_Sound.playSound("Sound_Click");
					}
					if (m_button_MusicOn.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true&&m_button_MusicOn.visible==true)
					{
						setMusicOff();
						if (database.instance.m_testPlaySound == true)
							database.instance.m_Sound.playSound("Sound_Click");
					}
					else
						if (m_button_MusicOff.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true&&m_button_MusicOff.visible==true)
						{
							setMusicOn();
							if (database.instance.m_testPlaySound == true)
								database.instance.m_Sound.playSound("Sound_Click");
						}
					if (m_button_SoundOn.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true&&m_button_SoundOn.visible==true)
					{
						setSoundOff();
					}
					else
						if (m_button_SoundOff.bounds.containsPoint(new Point(touch.globalX, touch.globalY))==true&&m_button_SoundOff.visible==true)
						{
							setSoundOn();
							if (database.instance.m_testPlaySound == true)
								database.instance.m_Sound.playSound("Sound_Click");
						}
				}
				else if (touch.phase == TouchPhase.HOVER)
				{
					if (m_button_Start.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_Start.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_Start.filter = null;
					if (m_guide_next.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_guide_next.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_guide_next.filter = null;
					if (m_button_Question.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_Question.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_Question.filter = null;
					if (m_button_Update.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_Update.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_Update.filter = null; 
					if (m_button_MusicOn.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_MusicOn.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_MusicOn.filter = null;
						
					if (m_button_MusicOff.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_MusicOff.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_MusicOff.filter = null;
						
					if (m_button_SoundOn.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_SoundOn.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_SoundOn.filter = null;
						
					if (m_button_SoundOff.bounds.containsPoint(new Point(touch.globalX, touch.globalY)) == true)
					{
						m_button_SoundOff.filter = BlurFilter.createDropShadow(0, 0, 0xffffff, 1, 1, 0.5);
					}
					else
						m_button_SoundOff.filter = null;
						
						
				}
			}
		}
		
		public function init():void
		{
			
			m_rung7 = 0.01;
			m_guide_image_1 = new Image ( Assets.getTexture("guide_1"));
			setCenterPivot(m_guide_image_1);
			setPos(m_guide_image_1, 1050/ 2, 700 / 2);
			m_guide_image_2=new Image ( Assets.getTexture("guide_2"));
			setCenterPivot(m_guide_image_2);
			setPos(m_guide_image_2, 1050/ 2, 700 / 2);
			m_guide_image_3 = new Image ( Assets.getTexture("guide_3"));
			setCenterPivot(m_guide_image_3);
			setPos(m_guide_image_3, 1050/ 2, 700 / 2);
			m_guide_image_4 = new Image ( Assets.getTexture("guide_4"));
			setCenterPivot(m_guide_image_4);
			setPos(m_guide_image_4, 1050/ 2, 700 / 2);
			m_guide_image_5 = new Image ( Assets.getTexture("guide_5"));
			setCenterPivot(m_guide_image_5);
			setPos(m_guide_image_5, 1050/ 2, 700 / 2);
			m_guide_next = new Image ( Assets.getTexture("Lui"));
			setCenterPivot(m_guide_next);
			setPos(m_guide_next, 1000, 650);
			m_guide_next.rotation = 3.14;
			m_test_guide = false;
			ManagerEffect.instance.m_layer = this;
			m_rung = 5;
			m_rung1 = 5;
			m_rung2 = 5;
			m_rung3 = 5;
			m_rung4 = 5;
			m_rung5 = 5;
			m_rung6 = 5;
			m_rung8 = 5;
			m_button_MusicOn=new Image ( Assets.getTexture("musicon"));
			m_button_MusicOff=new Image ( Assets.getTexture("musicoff"));
			m_button_SoundOn=new Image ( Assets.getTexture("soundon"));
			m_button_SoundOff=new Image ( Assets.getTexture("soundoff"));
			m_background = new Image ( Assets.getTexture("background1"));
			m_Khung_Ten=new Image ( Assets.getTexture("Khung_ten"));
			m_background.pivotX = m_background.width / 2;
			m_background.pivotY =m_background.height / 2;
			m_background.x = 1050/2;
			m_background.y = 700 / 2;
			
			setCenterPivot(m_Khung_Ten);
			setPos(m_Khung_Ten, 525, 90);
			
			setCenterPivot(m_button_MusicOn);
			setPos(m_button_MusicOn, 950, 25);
			
			setCenterPivot(m_button_MusicOff);
			setPos(m_button_MusicOff, 950, 25);
			
			setCenterPivot(m_button_SoundOff);
			setPos(m_button_SoundOff, 1005 , 25);
			
			setCenterPivot(m_button_SoundOn);
			setPos(m_button_SoundOn, 1005, 25);
			
			m_button_Start = new Image(Assets.getTexture("Chon"));
			setCenterPivot(m_button_Start);
			setPos(m_button_Start, 1050 / 2, 300);
			setCenterPivot(m_text_Start);
			setPos(m_text_Start, m_button_Start.x, m_button_Start.y);
			
			m_button_Question = new Image(Assets.getTexture("Chon"));
			setCenterPivot(m_button_Question);
			setPos(m_button_Question, 1050 / 2, 380);
			setCenterPivot(m_text_Question);
			setPos(m_text_Question, m_button_Question.x, m_button_Question.y);
			
			m_button_Update = new Image(Assets.getTexture("Share"));
			setCenterPivot(m_button_Update);
			setPos(m_button_Update, 965, 95);
			
			setCenterPivot(m_textUrl);
			
			setPos(m_textUrl, 1050 / 2, 92);
			this.addChild(m_background);
			this.addChild(m_button_Start);
			this.addChild(m_button_Question);
			this.addChild(m_button_Update);
			this.addChild(m_text_Start);
			this.addChild(m_text_Question);
			this.addChild(m_button_MusicOff);
			this.addChild(m_button_MusicOn);
			this.addChild(m_button_SoundOff);
			this.addChild(m_button_SoundOn);
			//m_background.blendMode = BlendMode.NONE;
			this.addChild(m_Khung_Ten);
			this.addChild(m_textUrl);
			setDefaultSprite();
			IncludeMusic();
			IncludeSound();
			//database.instance.m_Sound.playSound("Sound_Click");
			
			this.addChild(m_guide_image_1);
			this.addChild(m_guide_image_2);
			this.addChild(m_guide_image_3);
			this.addChild(m_guide_image_4);
			this.addChild(m_guide_image_5);
			this.addChild(m_guide_next);
			
			if (database.instance.m_testPlayMusic == true)
			{
				setMusicOn();
			}
			else
				setMusicOff();
				
			if (database.instance.m_testPlaySound == true)
			{
				setSoundOn();
			}
			else
				setSoundOff();
				
		}
		
		private function setSoundOff():void
		{
			database.instance.m_testPlaySound = false;
			m_button_SoundOn.visible = false;
			m_button_SoundOff.visible = true;
		}
		private function setSoundOn():void
		{
			database.instance.m_testPlaySound = true;
			m_button_SoundOn.visible = true;
			m_button_SoundOff.visible = false;
		}
		
		private function setMusicOff():void
		{
			database.instance.m_testPlayMusic = false;
			database.instance.m_Music.stopSound("Menu_Music");
			m_button_MusicOn.visible = false;
			m_button_MusicOff.visible = true;
		}
		private function setMusicOn():void
		{
			database.instance.m_testPlayMusic = true;
			database.instance.m_Music.playSound("Menu_Music", 1.0, 999);
			m_button_MusicOn.visible = true;
			m_button_MusicOff.visible = false;
		}
		private function onAddedToStage(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
	
			
		}
		private function IncludeSound():void
		{
			database.instance.m_Sound.addSound("Sound_Click", (new Sound_Click()) as Sound);
			database.instance.m_Sound.addSound("Sound_Sword", (new Sound_Sword()) as Sound);
			database.instance.m_Sound.addSound("Sound_Canon", (new Sound_Canon()) as Sound);
			database.instance.m_Sound.addSound("Sound_Arrow", (new Sound_arrow()) as Sound);
			database.instance.m_Sound.addSound("Sound_Blade", (new Sound_Blade()) as Sound);
			
			
		}
		private function IncludeMusic():void
		{
			database.instance.m_Music.addSound("Menu_Music", (new Menu_Music()) as Sound);
			database.instance.m_Music.addSound("ChooseStage_Music", (new ChooseStage_Music()) as Sound);
			database.instance.m_Music.addSound("ChooseLevel_Music", (new ChooseLevel_Music()) as Sound);
			database.instance.m_Music.addSound("GamePlay_Music", (new GamePlay_Music()) as Sound);
			database.instance.m_Music.addSound("Win_Music", (new Win_Music()) as Sound);
			database.instance.m_Music.addSound("Lose_Music", (new Lose_Music()) as Sound);
			database.instance.m_Music.addSound("ChooseQuestion_Music", (new ChooseQuestion_Music()) as Sound);
			database.instance.m_Music.addSound("Question_Music", (new Question_Music()) as Sound);
			database.instance.m_Music.addSound("Update_Music", (new Update_Music()) as Sound);
		}
		private function update(e:Event):void 
		{
			ManagerEffect.instance.update(Global.FRAME);

			if (m_testInit == true)
			{
				init();
				m_testInit = false;
			}
			if (database.instance.RESULTSTARSTAGE1[0] == 0 && database.instance.m_curStage == 0)
			{
				m_test_guide = true;
				if (m_guide_next.scaleX > 1.1)
				{
					m_rung7 *= -1;
				}
				if (m_guide_next.scaleX < 0.9)
				{
					m_rung7 *=- 1;
				}
				m_guide_next.scaleX += m_rung7;
				m_guide_next.scaleY += m_rung7;
				if (m_guide_image_1.x <=-50)
				{
					m_test_guide = false;
					m_guide_next.visible = false;
					m_guide_image_1.visible = false;
					m_guide_image_2.visible = false;
					m_guide_image_3.visible = false;
					m_guide_image_4.visible = false;
					m_guide_image_5.visible = false;
				}
				if (m_test_move_guide == true)
				{
					if (m_guide_image_5.x != 1050 / 2 - 1050)
					{
						moveleft(m_guide_image_5,1050/2-1050);
					}else
					if (m_guide_image_4.x != 1050 / 2 - 1050)
					{
						moveleft(m_guide_image_4,1050/2-1050);
					}else
					if (m_guide_image_3.x != 1050 / 2 - 1050)
					{
						moveleft(m_guide_image_3,1050/2-1050);
					}else
					if (m_guide_image_2.x != 1050 / 2 - 1050)
					{
						moveleft(m_guide_image_2,1050/2-1050);
					}else
					if (m_guide_image_1.x != 1050 / 2 - 1050)
					{
						moveleft(m_guide_image_1,1050/2-1050);
					}
				}
			}
			else
			{
				m_test_guide = false;
				m_guide_next.visible = false;
				m_guide_image_1.visible = false;
				m_guide_image_2.visible = false;
				m_guide_image_3.visible = false;
				m_guide_image_4.visible = false;
				m_guide_image_5.visible = false;
				
			}
			if (m_testStart == true&&m_test_guide==false)
			{
				
				ZoomSprite(m_background);
				if (m_background.scaleX == 1)
				{
					ZoomSprite(m_Khung_Ten);
					ZoomSprite(m_textUrl);
					m_rung = rung(m_background, m_rung,0);
					if (m_rung == 0)
					{
						ZoomSprite(m_button_Start);
						ZoomSprite(m_text_Start);
						if (m_button_Start.scaleX == 1)
						{
							m_rung1 = rung(m_button_Start, m_rung1,1);
							m_text_Start.x = m_button_Start.x;
							m_text_Start.y = m_button_Start.y ;
						}
						if (m_rung1 == 0)
						{
							ZoomSprite(m_button_Question);
							ZoomSprite(m_text_Question);
							if (m_button_Question.scaleX == 1)
							{
								m_rung2 = rung(m_button_Question, m_rung2,1);
								m_text_Question.x = m_button_Question.x;
								m_text_Question.y = m_button_Question.y;
							}
							if (m_rung2 == 0)
							{
								ZoomSprite(m_button_SoundOn);
								ZoomSprite(m_button_SoundOff);
								ZoomSprite(m_button_MusicOn);
								ZoomSprite(m_button_MusicOff);
								ZoomSprite(m_button_Update);
								if (m_button_MusicOn.scaleX == 1)
								{
									m_rung3 = rung(m_button_SoundOn, m_rung3,0);
									m_rung4 = rung(m_button_SoundOff, m_rung4,0);
									m_rung5 = rung(m_button_MusicOn, m_rung5,0);
									m_rung6 = rung(m_button_MusicOff, m_rung6, 0);
									m_rung8 = rung(m_button_Update, m_rung7,0);
								}
							}
						}
					}
				}
			}
			if(database.instance.UserName!=null)
				m_textUrl.text = "Tướng quân " +database.instance.UserName;
				//m_textUrl.text = "Tướng quân " +ExternalInterface.call("Get_DisPlay_Name");
		}
		private function ZoomSprite(obj:Object):void
		{
			if (obj.scaleX < 1)
			{
				obj.scaleX += 0.05;
				obj.scaleY = obj.scaleX;
			}
			else
			{
				obj.scaleX = 1;
				obj.scaleY = 1;
				
			}
		}
		public function rung(obj:Object, _rung:int,_buzz:int):int
		{
			if (_rung != 0)
				{
					if (_rung > 0)
					{
						_rung -= 1;
					}
					obj.x += _rung;
					obj.y -= _rung;
					_rung *= -1;
					if(_rung==4&&_buzz==1)
						ManagerEffect.instance.AddEff(new Star_Effect(ManagerEffect.instance.m_layer, new PDParticleSystem(XML(new AssetsParticles.ParticleXML()), Texture.fromBitmap(new AssetsParticles.ParticleTexture())), new Point(obj.x, obj.y), 50));
					if(_rung==4&&_buzz==2)
						ManagerEffect.instance.AddEff(new Star_Effect(ManagerEffect.instance.m_layer, new PDParticleSystem(XML(new AssetsParticles.ParticleXML1()), Texture.fromBitmap(new AssetsParticles.ParticleTexture1())), new Point(obj.x, obj.y), 50));
					return _rung;
				}
				return _rung;
		}
		private function setDefaultSprite():void
		{
			this.width = 1050;
			this.height = 700;
			this.pivotX = this.width / 2;
			this.pivotY = this.height / 2;
			this.x = this.width / 2;
			this.y = this.height / 2;
			m_background.scaleX = 0.1;
			m_background.scaleY = 0.1;
			m_button_Start.scaleX = 0;
			m_button_Start.scaleY = 0;
			m_text_Start.scaleX = 0;
			m_text_Start.scaleY = 0;
			m_button_Question.scaleX = 0;
			m_button_Question.scaleY = 0;
			m_text_Question.scaleX = 0;
			m_text_Question.scaleY = 0;
			m_button_SoundOn.scaleX = 0;
			m_button_SoundOn.scaleY = 0;
			m_button_SoundOff.scaleX = 0;
			m_button_SoundOff.scaleY = 0;
			m_button_MusicOn.scaleX = 0;
			m_button_MusicOn.scaleY = 0;
			m_button_MusicOff.scaleX = 0;
			m_button_MusicOff.scaleY = 0;
			m_textUrl.scaleX = 0;
			m_textUrl.scaleY = 0;
			m_Khung_Ten.scaleX = 0;
			m_Khung_Ten.scaleY = 0;
			m_button_Update.scaleX = 0;
			m_button_Update.scaleY = 0;
		}
		public function disposeTemporarily():void
		{
			ManagerEffect.instance.ListEff.splice(0, ManagerEffect.instance.ListEff.length);
			this.removeChildren(0, this.numChildren, false);
			database.instance.m_Music.stopSound("Menu_Music");
			this.m_testStart = false;
			this.visible = false;
		}
		public function setCenterPivot(_object:Object):void
		{	
			_object.pivotX = _object.width / 2;
			_object.pivotY = _object.height / 2;
		}
		public function setCenterPivotXY(_object:Object,_x:Number,_y:Number):void
		{	
			_object.pivotX = _x;
			_object.pivotY = _y;
		}
		public function setPos(_object:Object,_x:int,_y:int):void
		{	
			_object.x = _x;
			_object.y = _y;
		}
		public function setScale(_object:Object,_x:Number,_y:Number):void
		{	
			_object.scaleX = _x;
			_object.scaleY = _y;
		}
		public function setSize(_object:Object,_x:int,_y:int):void
		{	
			_object.width = _x;
			_object.height = _y;
		}
	}
}